package App.Utils;

import org.omg.Messaging.SYNC_WITH_TRANSPORT;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 认证类
 * Created by yu on 2017/7/18.
 */
public class Valiation
{
    public static boolean checkEmail(String email)
    {
        Pattern p =  Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");//复杂匹配
        Matcher m = p.matcher(email);
        return m.matches();
    }

    public static boolean checkImageType(String targetType,String... types)
    {
        if(!targetType.contains("image"))
            return false;
        for(String item:types)
        {
            if(targetType.contains(item))
            {
                return true;
            }
        }
        return false;
    }

}
